package org.glickr.api.places

import org.glickr.api.FlickrApiMethod
import groovy.util.slurpersupport.GPathResult

/* ----------------------------------------------------------------------------------------------------
REQUEST: flickr.places.placesForTags
INFO: Return a list of the top 100 unique places clustered by a given placetype for set of tags or machine tags.

AUTHENTICATION: This method does not require authentication.

ARGUMENTS:
api_key (Required): Your API application key.
place_type_id (Required): The numeric ID for a specific place type to cluster photos by.
Valid place type IDs are :
-22: neighbourhood
-7: locality
-8: region
-12: country
-29: continent
woe_id (Optional): A Where on Earth identifier to use to filter photo clusters. For example all the photos clustered by locality in the United States (WOE ID 23424977).

(While optional, you must pass either a valid Places ID or a WOE ID.)
place_id (Optional): A Flickr Places identifier to use to filter photo clusters. For example all the photos clustered by locality in the United States (Place ID 4KO02SibApitvSBieQ).

(While optional, you must pass either a valid Places ID or a WOE ID.)
threshold (Optional): The minimum number of photos that a place type must have to be included. If the number of photos is lowered then the parent place type for that place will be used.
For example if you only have 3 photos taken in the locality of Montreal (WOE ID 3534) but your threshold is set to 5 then those photos will be "rolled up" and included instead with a place record for the region of Quebec (WOE ID 2344924).
tags (Optional): A comma-delimited list of tags. Photos with one or more of the tags listed will be returned.
tag_mode (Optional): Either 'any' for an OR combination of tags, or 'all' for an AND combination. Defaults to 'any' if not specified.
machine_tags (Optional): Aside from passing in a fully formed machine tag, there is a special syntax for searching on specific properties :
  -Find photos using the 'dc' namespace :    "machine_tags" => "dc:"
  - Find photos with a title in the 'dc' namespace : "machine_tags" => "dc:title="
  -Find photos titled "mr. camera" in the 'dc' namespace : "machine_tags" => "dc:title=\"mr. camera\"
  -Find photos whose value is "mr. camera" : "machine_tags" => "*:*=\"mr. camera\""
  -Find photos that have a title, in any namespace : "machine_tags" => "*:title="
  -Find photos that have a title, in any namespace, whose value is "mr. camera" : "machine_tags" => "*:title=\"mr. camera\""
  -Find photos, in the 'dc' namespace whose value is "mr. camera" : "machine_tags" => "dc:*=\"mr. camera\""
 Multiple machine tags may be queried by passing a comma-separated list. The number of machine tags you can pass in a single query depends on the tag mode (AND or OR) that you are querying with. "AND" queries are limited to (16) machine tags. "OR" queries are limited
to (8).
machine_tag_mode (Optional): Either 'any' for an OR combination of tags, or 'all' for an AND combination. Defaults to 'any' if not specified.
min_upload_date (Optional): Minimum upload date. Photos with an upload date greater than or equal to this value will be returned. The date should be in the form of a unix timestamp.
max_upload_date (Optional): Maximum upload date. Photos with an upload date less than or equal to this value will be returned. The date should be in the form of a unix timestamp.
min_taken_date (Optional): Minimum taken date. Photos with an taken date greater than or equal to this value will be returned. The date should be in the form of a mysql datetime.
max_taken_date (Optional): Maximum taken date. Photos with an taken date less than or equal to this value will be returned. The date should be in the form of a mysql datetime.

EXAMPLE RESPONSE:
<places total="1">
  <place place_id="kH8dLOubBZRvX_YZ" woeid="2487956" latitude="37.779" longitude="-122.420" place_url="/United+States/California/San+Francisco" place_type="locality" photo_count="156">San Francisco, California</place>
</places>
---------------------------------------------------------------------------------------------------- */

class placesPlacesForTags implements FlickrApiMethod {
    //
    //  API METHOD
    //
    static final String apiMethod = 'flickr.places.placesForTags'

    //
    //  VALIDATOR
    //

    //
    //  PARAMS
    //

    //
    //  PROCESSOR
    //

    //
    //  ERROR CODES
    //
}